#ifndef ANIMATION_H
#define ANIMATION_H

#include <vector>
#include "Texture.h"
#include "Entity.h"

class AnimationBase
{
	protected:

		Entity * object;

		int nFrames;

		int FPSRate;
		int StartFrame;
		int EndFrame;
		int CurrentFrame;
		bool Pause;
		bool Loop;

	public:
					 ///Constructor
		AnimationBase();
					 ///Destructor
		virtual ~AnimationBase();
		
		virtual void AnimationForEntity(Entity * object);

		virtual void SetFPSRate(int FramesPerSecond=12);
		virtual void SetStartFrame(int s=0);
		virtual void SetEndFrame(int e=-1);
		virtual void SetCurrentFrame(int c);

		virtual void Start(float dt);
		virtual void Stop();
		virtual void Reset();

		virtual int GetCurrentFrame();

};

class AnimationSheet : public AnimationBase
{
	private:

		TexCoord texcoord[4];
		Texture * prevTexture;
		Texture * textureSheet;

		float xInc;
		float yInc;
		int nCellX;
		int nCellY;

	public:

		AnimationSheet();
		~AnimationSheet();

		void SetTextureSheet(Texture * texture, int cellSize);
		void Start(float dt);
};

class Animation : public AnimationBase
{
	private:
									///Animation
		std::vector<Texture *> anim;

	public:

		Animation();
		~Animation();

		void AddTextureFrame(Texture * texture);
		void Start(float dt);
};
#endif